package com.solcoo.customer.ui.pic;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;

import com.android.common.image.ImageLoader;
import com.android.common.util.StringUtil;
import com.solcoo.customer.R;
import com.solcoo.customer.base.BaseActivity;

public class PicBrowerActivity extends BaseActivity {

	public static final String INTENT_KEY = "url";

	ImageView pic;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.pic_brower);
		String url = getIntent().getStringExtra(INTENT_KEY);
		if (StringUtil.isBlank(url)) {
			return;
		}
		pic = (ImageView) findViewById(R.id.pic);
		ImageLoader.getInstance().load(url, pic,
				R.drawable.default_loading_have_bg, null);
	}

	public static class PicOnClickListener implements OnClickListener {

		public String url;

		public PicOnClickListener(String url) {
			this.url = url;
		}

		@Override
		public void onClick(View v) {
			Intent it = new Intent(v.getContext(), PicBrowerActivity.class);
			it.putExtra(INTENT_KEY, url);
			v.getContext().startActivity(it);
		}
	};

	public void picOnClick(View v) {
		finish();
	}
}
